#!/bin/bash
# description: Install tigervnc server for UOS desktop professional
# version: 0.0.1
# author: ZhangChiQian<zhangchiqian@uniontech.com>
# date: 2021-11-29
echo "+------------------------------------------+"
echo "|   开始卸载v11vnc		                     "
echo "|   卸载过程中要多次输入管理员密码，请保持耐心 	" 
echo "+------------------------------------------+"

echo -e "\033[40;37m 正在停止tigervnc进程 \033[0m"
sudo killall vncserver
sudo killall Xtigervnc
sudo killall startdde
dpkg -l tigervnc-common &>/dev/null && dpkg -l tigervnc-standalone-server &>/dev/null
if dpkg -l tigervnc-common &>/dev/null || dpkg -l tigervnc-standalone-server &>/dev/null ;then
    echo "正在卸载tigervnc server"
    sudo dpkg -P tigervnc-common tigervnc-standalone-server
fi
sudo rm -f /lib/systemd/system/tigervnc.service
sudo rm -rf ~/.vnc
sudo systemctl daemon-reload
if [ $? -eq 0 ];then
    echo -e "\033[40;37m 卸载完成，按任意键退出 \033[0m"
    read i
    exit 0
fi